using Domain.Repositories;
using Grpc.Core;

namespace Grpc.Services;

public class GreeterService(IUserRepository userRepository) : UserService.UserServiceBase
{
    public override async Task<GetUserInfoReply> GetUserInfo(GetUserInfoRequest request, ServerCallContext context)
    {
       var user = await userRepository.GetAsync(u => u.Id == request.Id);
       return new GetUserInfoReply()
       {
           Id = user.Id,
           RealName = user.RealName,
           Password = user.Password,
           Email = user.Email,
           LoginName = user.LoginName,
           Phone = user.Phone,
       };
    }
}